package com.zmn.oms.services.impl.mediadetection;

import com.zmn.common.utils.date.DateUtil;
import com.zmn.oms.model.entity.mediadetection.MediaDetectionResult;
import com.zmn.oms.persistence.interfaces.mediadetection.MediaDetectionResultDao;
import com.zmn.oms.services.interfaces.mediadetection.MediaDetectionResultService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 类描述：媒体质检结果
 *
 * @author ligang
 * @since 2022/07/15 10:18
 */
@Service
public class MediaDetectionResultServiceImpl implements MediaDetectionResultService {

    @Resource
    private MediaDetectionResultDao mediaDetectionResultDao;

    /**
     * 添加结果
     *
     * @param mediaDetectionResult
     * @return
     */
    public int addResult(MediaDetectionResult mediaDetectionResult) {
        Date now = DateUtil.getNow();
        mediaDetectionResult.setCreateTime(now);
        mediaDetectionResult.setUpdateTime(now);
        return mediaDetectionResultDao.insert(mediaDetectionResult);
    }

    /**
     * 更新结果
     *
     * @param mediaDetectionResult
     * @return
     */
    @Override
    public int updateResultByBizRecordId(MediaDetectionResult mediaDetectionResult) {
        mediaDetectionResult.setUpdateTime(DateUtil.getNow());
        return mediaDetectionResultDao.updateByBizRecordId(mediaDetectionResult);
    }
}
